# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html

# Sets the minimum version of CMake required to build the native library.

cmake_minimum_required(VERSION 3.4.1)

# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.



enable_language(ASM)

add_library( # Sets the name of the library.
             uvccamera-lib

             # Sets the library as a shared library.
             SHARED

			#main
				src/main/cpp/utilbase.c			
				src/main/cpp/uvccamera-lib.cpp
				src/main/cpp/frame.c

			#lane
				src/main/cpp/lane.cpp
				src/main/cpp/lane.h
			
			#libjpeg-turbo
				src/main/cpp/mjpeg_decoder.cpp
				src/main/cpp/libdecode/turbojpeg.c
				src/main/cpp/libdecode/jerror.c
				src/main/cpp/libdecode/tjutil.c
#				src/main/cpp/libdecode/transupp.c
				src/main/cpp/libdecode/cdjpeg.c
				src/main/cpp/libdecode/jdapimin.c
				src/main/cpp/libdecode/jdmaster.c
				src/main/cpp/libdecode/jdatasrc-tj.c
				src/main/cpp/libdecode/jdapistd.c
				src/main/cpp/libdecode/jdcoefct.c
				src/main/cpp/libdecode/jdsample.c
				src/main/cpp/libdecode/jchuff.c
				src/main/cpp/libdecode/jcomapi.c
				src/main/cpp/libdecode/jutils.c
				src/main/cpp/libdecode/jmemmgr.c
				src/main/cpp/libdecode/jdmarker.c
				src/main/cpp/libdecode/jdinput.c
				src/main/cpp/libdecode/jdpostct.c
				src/main/cpp/libdecode/jddctmgr.c
				src/main/cpp/libdecode/jquant1.c
				src/main/cpp/libdecode/jmemnobs.c
				src/main/cpp/libdecode/jdmerge.c
				src/main/cpp/libdecode/jdcolor.c
				src/main/cpp/libdecode/jdarith.c
				src/main/cpp/libdecode/jdphuff.c
				src/main/cpp/libdecode/jdhuff.c
				src/main/cpp/libdecode/jdmainct.c
				src/main/cpp/libdecode/jidctint.c
				src/main/cpp/libdecode/jquant2.c
				src/main/cpp/libdecode/jidctred.c
				src/main/cpp/libdecode/jidctflt.c
				src/main/cpp/libdecode/jidctfst.c
				src/main/cpp/libdecode/jaricom.c
				
				src/main/cpp/libdecode/simd/arm/jsimd_neon.S
				src/main/cpp/libdecode/simd/arm/jsimd.c
				
	 
			#openGLes
				src/main/cpp/opengles/cameraShader.c
				src/main/cpp/opengles/esUtil.c
				src/main/cpp/opengles/matrix.c
			
			#libyuv
				src/main/cpp/libyuv/source/compare.cc
				src/main/cpp/libyuv/source/compare_common.cc
				src/main/cpp/libyuv/source/convert.cc
				src/main/cpp/libyuv/source/convert_argb.cc
				src/main/cpp/libyuv/source/convert_from.cc
				src/main/cpp/libyuv/source/convert_from_argb.cc
				src/main/cpp/libyuv/source/convert_to_argb.cc
				src/main/cpp/libyuv/source/convert_to_i420.cc
				src/main/cpp/libyuv/source/cpu_id.cc
				src/main/cpp/libyuv/source/planar_functions.cc
				src/main/cpp/libyuv/source/rotate.cc
				src/main/cpp/libyuv/source/rotate_any.cc
				src/main/cpp/libyuv/source/rotate_argb.cc
				src/main/cpp/libyuv/source/rotate_common.cc
				src/main/cpp/libyuv/source/row_any.cc
				src/main/cpp/libyuv/source/row_common.cc
				src/main/cpp/libyuv/source/scale.cc
				src/main/cpp/libyuv/source/scale_any.cc
				src/main/cpp/libyuv/source/scale_argb.cc
				src/main/cpp/libyuv/source/scale_common.cc
				src/main/cpp/libyuv/source/video_common.cc
				src/main/cpp/libyuv/source/compare_neon.cc
				src/main/cpp/libyuv/source/rotate_neon.cc
				src/main/cpp/libyuv/source/row_neon.cc
				src/main/cpp/libyuv/source/scale_neon.cc
				src/main/cpp/libyuv/source/compare_neon.cc
				src/main/cpp/libyuv/source/scale_neon.cc
				src/main/cpp/libyuv/source/mjpeg_decoder.cc
				src/main/cpp/libyuv/source/mjpeg_validate.cc
				src/main/cpp/libyuv/source/convert_jpeg.cc
              )


find_library( # Sets the name of the path variable.
              log-lib

              # Specifies the name of the NDK library that
              # you want CMake to locate.
              log )
find_library( # Sets the name of the path variable.
               android-lib

               # Specifies the name of the NDK library that
               # you want CMake to locate.
               android )
 find_library( # Sets the name of the path variable.
                z-lib

                # Specifies the name of the NDK library that
                # you want CMake to locate.
                z )
 find_library( # Sets the name of the path variable.
                 OpenSLES-lib

                 # Specifies the name of the NDK library that
                 # you want CMake to locate.
                 OpenSLES )
 find_library( # Sets the name of the path variable.
                gles-lib

                # Specifies the name of the NDK library that
                # you want CMake to locate.
                GLESv2 )


include_directories(src/main/cpp/libyuv/include)
include_directories(src/main/cpp/libdecode/include)
include_directories(src/main/cpp/opengles)
# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.

target_link_libraries( # Specifies the target library.
                      uvccamera-lib

                       # Links the target library to the log library
                       # included in the NDK.
						${android-lib}
						${z-lib}
						${log-lib}
						${gles-lib}
					)
